
#include <fstream>
#include <iostream>
#include "gflags/gflags.h"
#include "glog/logging.h"
#include "protobuf/text_format.h"
#include "gps.pb.h"
#include "gpx_parser.h"

DEFINE_string(ingpb, "", "file.gpb");

int main(int argc, char** argv) {
  google::InitGoogleLogging(argv[0]);
  google::ParseCommandLineFlags(&argc, &argv, false);
  if (FLAGS_ingpb.empty()) {
    LOG(ERROR) << "missing arg --ingpb file.gpb";
    return 1;
  }
  std::ifstream input_gpb(FLAGS_ingpb.c_str(),
                          std::ios_base::in|std::ios_base::binary);
  gps_proto::GpsProto gps_proto;
  gps_proto.ParseFromIstream(&input_gpb);
  std::string text;
  google::protobuf::TextFormat::PrintToString(gps_proto, &text);
  std::cout << text;
}
